package com.mashibing.juc.c_025;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue;

public class T08_SynchronusQueue {

	public static void main(String[] args) throws InterruptedException {

		SynchronousQueue<String> synchronousQueue = new SynchronousQueue<>();
		
		new Thread(()->{
			try {
				System.out.println(synchronousQueue.take());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}).start();

		synchronousQueue.put("aaa");
//		synchronousQueue.put("bbb");
		synchronousQueue.add("aaa");
		System.out.println(synchronousQueue.size());

	}

}
